<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>碰撞检测</title>
  <style>
    body{
      margin: 0;
      padding: 0;
      background: #8b7dbe;
    }
    #box{
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    }
    .box1{
      position: absolute;
      top: 280px;
      left: 290px;
      width: 80px;
      height: 80px;
      background: #ffffff;
    }
    .box2{
      position: absolute;
      top: 0;
      left: 0;
      width: 80px;
      height: 80px;
      background: red;
    }
  </style>
</head>
<body>
<div id="box">
  <div class="box1" id="peng"></div>
  <div class="box2" id="touch"></div>
</div>
<script src="main.js"></script>
</body>
</html>